package org.spring.batch.ch05;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spring.batch.ch05.model.Group;
import org.springframework.jdbc.core.RowMapper;

public class GroupJdbcRowMapper implements RowMapper<Group> {
	private final Logger logger = LoggerFactory.getLogger(getClass());

	@Override
	public Group mapRow(ResultSet rs, int rowNum) throws SQLException {
		logger.info("正在读取结果集中的第{}行。", rowNum);
		Group group = new Group();
		group.setName(rs.getString("name"));
		group.setDescription(rs.getString("description"));
		group.setId(rs.getInt("id"));
		return group;
	}

}
